﻿public class Solution69
{
    public int MySqrt(int x)
    {

        int ans = 0;
        int left = 0;
        int right = x;
        while (left <= right)
        {
            int  mid = (left + right) / 2;
            if (mid* mid<= x){
                ans = mid;
                left = mid + 1;


            }else
            {

                right = mid - 1;
            }



        }
        return ans;
    }
}